#include"DList.h"

Node* _buynode(ElemType x)
{
	Node* s = (Node*)malloc(sizeof(Node));
	assert(s != NULL);
	s->data = x;
	s->next = s->prio = NULL;
	return s;
}

void InitDList(List* list)
{
	Node* s = (Node*)malloc(sizeof(Node));
	assert(s != NULL);
	list->first = list->last = s;
	list->last->next = NULL;
	list->last->prio = NULL;
	list->size = 0;
}

void push_back(List* list, ElemType x)
{
	Node* s = _buynode(x);
	s->prio = list->last;
	list->last->next = s;
	list->last = s;
	list->size++;
}



void show_List(List *list)
{
	Node* p = list->first->next;
	while (p!=NULL)
	{
		printf("%d-->", p->data);
		p = p->next;
	}
	printf("Nul.\n");
}